<?php
namespace Core\CoreContracts;
use Core;

require_once (CONTRACTS_DIR . '/statesmaterial.enum.php');
/*
* Material class definition
*/
class Material {

	/**
    * @property integer $Id The material unique identifier
    */
	public $Id;
	
	/**
    * @property integer $State The material state
    */
	public $State;
	
	/**
    * @property string $Name The material name
    */
	public $Name;
	
	/**
    * @property string $Description The material description
    */
	public $Description;
	
	/**
    * @property User $AffectedUser The affected user
    */
	public $AffectedUser;
	
	/**
    * @property User $LastAffectedUser The last affected user
    */
	public $LastAffectedUser;
	
	/**
    * @property string $Location The material location
    */
	public $Location;
	
	/**
    * @property datetime $ModificationDate The modification date 
    */
	public $ModificationDate;
	
	/**
    * @property datetime $CreationDate The creation date 
    */
	public $CreationDate;
	
	/**
	* The default constructor
	*/
	public function __construct()  {  }
	
	/*
	* Build a new user object
	*
	* @param string $name The task name
	* @param User $user The affected user
	*/
	public static function Create($state, $name, $description, $affectedUser, $location)
	{
		$material = new Core\CoreContracts\Material();
		$material->State = $state;
		$material->Name = $name;
		$material->Description = $description;
		$material->AffectedUser = $affectedUser;
		$material->LastAffectedUser = $affectedUser;
		$material->Location = $location;
		$material->ModificationDate = date("Y-m-d H:i:s");
		$material->CreationDate = date("Y-m-d H:i:s");
		return $material ;
	}
}
?> 